package com.doit.day06

object _01_继承 {
  def main(args: Array[String]): Unit = {
    val zi: Zi = new Zi(2,"思聪",5)
    println(zi.id)
//    zi.id = 2
    zi.fish()

    val zss: Stu1 = new Stu1(1, "zss", "male", 19)


    new Sun(2)


  }

}



class Fu(var id:Int,val name:String,val money:Int){
  def fish()={
    println("钓鱼")
  }
}


class Zi(id:Int,override val name:String,override val money:Int) extends Fu(id,name,money){

  override def fish(): Unit = {
    println("我也来钓鱼")
  }

  def playGames()={
    println("打游戏")
  }
}

class Sun(id:Int) extends Zi(10,"sj",12)


class Stu1(val id:Int,var name:String,gender:String,val age:Int){
  println(gender)
}
//反编译成java  gender是成员变量吗？

//我现在在上面定义的zss这个对象，能不能访问到这个gender